package com.cwvs.cat.bean;

import org.json.JSONException;
import org.json.JSONObject;

public class ClubDetail {

	    public int id;
		public String name;
		public String introduce;
		public String backgroudPicUrl;
		public int owner;
		public String ownerName;
		public String createdTime;
		public int recentNews;
		public String recentNewsContent;
		public String recentNewsPicUrl;
		public int recentActivity;
		public String recentActivityContent;
		public int count;
		public String shopNames;
		public int status;
		public int is_join;
	
	public void fromJson(JSONObject json){
		id = json.optInt("id");
		name = json.optString("name");
		introduce = json.optString("introduce");
		backgroudPicUrl = json.optString("background_pic");
		owner = json.optInt("owner");
		ownerName = json.optString("ownername");
		createdTime = json.optString("created");
		recentNews = json.optInt("recent_news");
		recentNewsContent = json.optString("recent_news_content");
		recentNewsPicUrl = json.optString("recent_news_pic");
		recentActivity = json.optInt("recent_activit");
		recentActivityContent = json.optString("recent_activit_content");
		count = json.optInt("count");
		shopNames = json.optString("shop");
		status = json.optInt("status");
		is_join = json.optInt("is_join");
	}
	
	public JSONObject toJson(){
		JSONObject json = new JSONObject();
		try {
			json.put("id", id);
			json.put("name", name);
			json.put("introduce",introduce);
			json.put("backgroud_pic", backgroudPicUrl);
			json.put("owner",owner);
			json.put("ownername", ownerName);
			json.put("created", createdTime);
			json.put("recent_news", recentNews);
			json.put("recent_news_content", recentNewsContent);
			json.put("recent_news_pic", recentNewsPicUrl);
			json.put("recent_activit", recentActivity);
			json.put("recent_activit_content", recentActivityContent);
			json.put("count", count);
			json.put("shop",shopNames);
			json.put("status", status);
			json.put("is_join", is_join);
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return json;
	}
	public static ClubDetail createFromJson(JSONObject json) {
		ClubDetail msgSystem = new ClubDetail();
		msgSystem.fromJson(json);
		return msgSystem;
	}
	
}
